home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / emacs16d.zip / DABBREV.MIN < prev    next >
Text File  |  1992-03-26  |  3KB  |  150 lines

  1. This code is by Michael Hirsch, William Su and Russell Nelson.
  2.  
  3.  
  4. Name:K.M-/
  5. [*]U:dabbrev[*]
  6.  
  7.  
  8. Name:K.M-Slash
  9. [*]U:dabbrev[*]
  10.  
  11.  
  12. Name:U-dabbrev-backwards-only
  13. If not null, dabbrev only searches backwards.
  14. [*][*]
  15.  
  16.  
  17. Name:U-dabbrev-fold
  18. If not null, dabbrev will fold case when searching for a
  19. matching prefix.  The prefix the user typed is not changed.
  20. The part copied is copied exactly as written in the original.
  21. No attempt is made to make the case match that of the prefix.
  22. [*][*]
  23.  
  24.  
  25. Name:U-dabbrev-insert-string
  26. [*]brev[*]
  27.  
  28.  
  29. Name:U-dabbrev-number
  30. [*]1[*]
  31.  
  32.  
  33. Name:U-dabbrev-search-string
  34. [*]Udabbrev-c[*]
  35.  
  36.  
  37. Name:U:dabbrev
  38. Dynamically finish the current word.  Check backwards through the
  39. file to find the last word to start with this pattern of letters, then
  40. complete the current word the same way.  If there is no previous such
  41. word, and U-dabbrev-backwards-only isn't null, check forwards.
  42. [*]    
  43. #(an)
  44. #(g?,arg1,1,(#(ds,dabbrev-number,arg1)))
  45. #(es,#(ls,(,),dabbrev-seen.))
  46. #(pm,5)
  47. #(sm,3,<)
  48. #(sp,-{)
  49. #(ds,dabbrev-search-string,##(rm,2))
  50. #(==,,##(dabbrev-search-string),(
  51.     #(Fmessage,Nothing to expand)
  52. ),(
  53.     #(sp,<)
  54.     #(ds,dabbrev-seen.)
  55.     #(lp,##(dabbrev-search-string),,,#(U-dabbrev-fold))
  56.     #(==,#(Udabbrev,,([)),(expanded),,(
  57.         #(==,#(U-dabbrev-backwards-only),,(
  58.             #(sp,2>)
  59.             #(==,#(Udabbrev,(#(sp,1)),(])),(expanded),,(
  60.                 #(Fmessage,((Can't find dynamic abbrev(,) forwards or backwards(,) for "##(dabbrev-search-string)".)))
  61.             ))
  62.         ),(
  63.             #(Fmessage,((Can't find dynamic abbrev(,) backwards only(,) for "##(dabbrev-search-string)")))
  64.         ))
  65.     ))
  66. ))
  67. #(sp,2)
  68. #(pm)
  69. #(es,#(ls,(,),dabbrev-seen.))
  70. #(ds,dabbrev-number,1)
  71. [*]
  72.  
  73.  
  74. Name:Udabbrev
  75. arg1 = null or #(sp,1) to go backwards or forwards.  Arg2 = [ or ] resp.
  76. [*]
  77. #(l?,.,arg2,0,1,(
  78.     #(sp,0)
  79.     #(mb,{,(
  80.         arg1
  81.         #(SELF,(arg1),(arg2))
  82.     ),(
  83.         #(==,arg2,[,(#(sm,4,0)),(#(sm,4,1)))
  84.         #(g?,#(dabbrev-number),1,(
  85.             #(ds,dabbrev-number,#(--,#(dabbrev-number),1))
  86.             #(sp,4)
  87.             #(SELF,(arg1),(arg2))
  88.         ),(
  89.             #(sp,1})
  90.             #(n?,dabbrev-seen.##(rm,1),(
  91.                 #(sp,4)
  92.                 #(SELF,(arg1),(arg2))
  93.             ),(
  94.                 #(ds,dabbrev-seen.##(rm,1))
  95.                 #(ds,dabbrev-insert-string,##(rm,1))
  96.                 #(sp,2)
  97.                 #(sm,1,<)
  98.                 #(is,##(dabbrev-insert-string))
  99.                 #(Fset-new-mark)
  100.                 #(sp,1>)
  101.                 #(F:swap-point-and-mark)
  102.                 #(rd)
  103.                 #(ds,tempSELF,#(Fget-key-with-prefixes))
  104.                 #(==,##(K.##(tempSELF)),U:dabbrev,(
  105.                     #(sp,3>)
  106.                     #(dm,2)
  107.                     #(sp,4)
  108.                     #(SELF,(arg1),(arg2))
  109.                 ),(
  110.                     #(Fkbd-in,##(tempSELF))
  111.                     expanded
  112.                 ))
  113.             ))
  114.         ))
  115.     ))
  116. ))
  117. [*]
  118.  
  119.  
  120. Name:Udabbrev-case-fold
  121. Given a string in dabbrev-search-string and dabbrev-insert-string, return the
  122. insert string folded to match the case of the search string.
  123.   arg1 = ASCII value of char from dabbrev-search-string
  124. [*]#(==,arg1,,,(
  125.     ##(si,Fxlat-#(Fisupper,arg1,upper,lower),
  126.         ##(go,dabbrev-insert-string))
  127. ))
  128. #(==,##(dabbrev-search-string),,(
  129.     ##(gn,dabbrev-insert-string,1000)
  130.     #(rs,dabbrev-search-string)
  131.     #(rs,dabbrev-insert-string)
  132. ),(
  133.     #(SELF,##(bc,##(go,dabbrev-search-string)))
  134. ))[*]
  135.  
  136.  
  137. Name:Udabbrev-do
  138. [*]
  139. #(sp,1})
  140. #(ds,dabbrev-insert-string,##(rm,1))
  141. #(sp,2)
  142. #(sm,1,<)
  143. #(is,##(dabbrev-insert-string))
  144. #(Fset-new-mark)
  145. #(sp,1>)
  146. #(F:swap-point-and-mark)
  147. [*]
  148.  
  149.  
  150.